<%-- 
    Document   : UserMain
    Created on : 11-oct-2011, 0:10:33
    Author     : TOSHIBA
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.sql.*" %>
<%@page import="edu.upeu.examlp1.comm.Conexion" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
         <form action="UserSave.jsp">
            <br> <input type="hidden" name="go" value="Create">
            <br>Name: <input type="text" name="nombre">
            <br>Email:<input type="text" name="email">
            <br>Cellular:<input type="text" name="mumero">
            <br><input type="submit">
        </form>
<%

        Conexion conn = new Conexion();
        try {           
            String qry="select * from User";
            PreparedStatement ps=conn.getConnection().prepareStatement(qry);
            ResultSet rs= ps.executeQuery();
            while(rs.next())
                out.println(
                        "<a href='UserForm.jsp?userId="+rs.getString("UserId")+"'>Edit</a> "+
                        rs.getString("UserId")+ " "+
                        rs.getString("Name")+ " "+
                        rs.getString("Email")+ " "+
                        rs.getString("Cellular")+"<br>");
            conn.close();
        } catch (Exception e) {
            out.print("Error: " +e.getMessage());
        }       
%>  
    </body>
</html>



